package com.henghai.zhenxuan.domain.request;

import androidx.annotation.NonNull;
import androidx.lifecycle.DefaultLifecycleObserver;
import androidx.lifecycle.LifecycleOwner;

import com.henghai.zhenxuan.data.api.ProductOrderInfoApi;
import com.henghai.zhenxuan.data.bean.HttpBean;
import com.henghai.zhenxuan.data.bean.OrderInfoBean;
import com.henghai.zhenxuan.data.repository.DataRepository;
import com.kunminx.architecture.data.response.DataResult;
import com.kunminx.architecture.domain.message.MutableResult;
import com.kunminx.architecture.domain.message.Result;
import com.kunminx.architecture.domain.request.Requester;

import org.jetbrains.annotations.NotNull;

;

public class ProductOrderInfoRequester extends Requester implements DefaultLifecycleObserver {

    private final MutableResult<DataResult<HttpBean<OrderInfoBean>>> productInfoResult = new MutableResult<>();

    public Result<DataResult<HttpBean<OrderInfoBean>>> getProductInfoResult() {
        return productInfoResult;
    }

    public void requestProductInfo(LifecycleOwner lifecycleOwner, int ProductId) {
        DataRepository.getInstance().productOrderInfo(lifecycleOwner, new ProductOrderInfoApi(ProductId), productInfoResult::postValue);
    }

    public void cancelLogin() {

    }

    @Override
    public void onStop(@NonNull @NotNull LifecycleOwner owner) {
        cancelLogin();
    }

}
